-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack switching proposal support #7041
Conversation
1be4ea5
to
d531797
Compare
This patch implements text and binary encoding/decoding support for the stack switching proposal. It does so by adapting the previous typed-continunations implementation. Particular changes: * Support for new `resume` encoding. * Added support for `resume_throw` and `switch`. * Feature flag `typed-continuations` has been renamed to `stack-switching`. A small unfortunate implementation detail is that the internal name `Switch` was already taken by the `br_table` instruction, so I opted to give the `switch` instruction the internal name `StackSwitch`. A minor detail is that I have reordered the declarations/definitions of the stack switching instructions such that they appear in ascending order according to their opcode value (this is the same order that the stack-switching explainer document present them in).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! Happy to meet and discuss any of these comments in real time if it would be more efficient for you.
Also, if you could avoid force pushes as you update the PR, that will help me see what changes from version to version. |
Yes, I only did that while rebasing and noone were reviewing :-) I will implement your feedback and push it directly on top of here. |
'ContNew' and 'ContBind'
@tlively I think I have addressed all of your feedback now. Please take a look when you got time. Thanks in advance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes! Here are a few more comments, but I think we're getting close.
This reverts commit d1866bc.
Do you prefer I resolve the merge conflict via rebase+force-push or just as a merge commit? |
A merge would be good, thanks! |
This commit is a partial solution to removing the type immediate members from `cont.new,cont.bind,resume,resume_throw,switch`. However, when I fully remove the type immediates then I observe a crash in `child-ir.h` on `visitContBind,visitResume,visitResumeThrow,visitStackSwitch`. It seems that `curr->cont->type` is sometimes not a continuation type...
82d683a
to
c549cd7
Compare
@tlively I am experiencing some difficulties with getting rid of the type immediate members ( |
Check out the pattern used by other instructions that take type immediates in child-typer.h, for example |
Thanks for the pointer. I have sorted it out now, I think. The latest commit ought to eliminate the type immediates from the stack switching instructions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a few comments on the tests.
Hi @tlively, apologies for the delay, I didn't have time to look into finishing this patch up until now. Hopefully my latest commit addresses your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, thanks for all your work on this, @dhil!
This patch implements text and binary encoding/decoding support for the stack switching proposal. It does so by adapting the previous typed-continunations implementation. Particular changes:
resume
encoding.resume_throw
andswitch
.typed-continuations
has been renamed tostack-switching
.A small unfortunate implementation detail is that the internal name
Switch
was already taken by thebr_table
instruction, so I opted to give theswitch
instruction the internal nameStackSwitch
.A minor detail is that I have reordered the declarations/definitions of the stack switching instructions such that they appear in ascending order according to their opcode value (this is the same order that the stack-switching explainer document present them in).
I can look into adding validation support in a subsequent patch.